US COVID Data

Data Prep

us <- read.csv("https://raw.githubusercontent.com/JaclynCoate/6373_Time_Series/master/TermProject/Data/USdaily7.19.csv", header = T, strip.white = T)
us <- transform(us, date = as.Date(as.character(date), "%Y%m%d"))
us <- subset(us, select = -c(states, dateChecked, hospitalized, lastModified, total, posNeg, totalTestResultsIncrease, hash))
us[is.na(us)] <- 0
#Selecting only those dates with reported current hospitilizations
us <- dplyr::slice(us,1:124)
us = us[order(as.Date(us$date, format = "%Y%m%d")),]
head(us)
##           date positive negative pending hospitalizedCurrently
## 124 2020-03-17    11928    63104    1687                   325
## 123 2020-03-18    15099    84997    2526                   416
## 122 2020-03-19    19770   108407    3016                   617
## 121 2020-03-20    26025   138814    3330                  1042
## 120 2020-03-21    32910   177262    3468                  1436
## 119 2020-03-22    42169   213476    2842                  2155
##     hospitalizedCumulative inIcuCurrently inIcuCumulative
## 124                     55              0               0
## 123                     67              0               0
## 122                     85              0               0
## 121                    108              0               0
## 120                   2020              0               0
## 119                   3023              0               0
##     onVentilatorCurrently onVentilatorCumulative recovered death
## 124                     0                      0         0   122
## 123                     0                      0         0   153
## 122                     0                      0         0   199
## 121                     0                      0         0   267
## 120                     0                      0         0   328
## 119                     0                      0         0   471
##     totalTestResults deathIncrease hospitalizedIncrease negativeIncrease
## 124            75032            22                   13            13707
## 123           100096            31                   12            21893
## 122           128177            46                   18            23410
## 121           164839            68                   23            30407
## 120           210172            61                 1912            38448
## 119           255645           143                 1003            36214
##     positiveIncrease
## 124             3613
## 123             3171
## 122             4671
## 121             6255
## 120             6885
## 119             9259

Forecast Current Hospitalizations

It is difficult to assume stationarity for this data due to multiple factors. We are working under the assumption that COVID is a novel virus and cases as well as hospitalizations will eventually return to zero. This being said our current modeling techniques do things such as return to the median or mimic the previously seen trends. Also, we see a severe upward trend in both new cases and hospitalization would be dependent on this as well as time. We will review the data and see what, if any, non-stationary components reveal themselves and model the data accordingly.

Original Data Realization

Traits: - Heavy wandering behavior - What appears to be some noise that could be pseudo-cyclic behavior hidden by the large numbers.

ggplot(data = us, aes(x=date, y=hospitalizedCurrently))+
  geom_line(color="orange")+
  labs(title = "Current COVID Hospitalized Cases US", y = "Thousands", x = "") +
  theme_hc()

Sample Realization, ACF, and Spectral Density

Realization - Heavy wandering behavior - Possible small pseudo-cyclic behavior ACF - Very slowly dampening behavior that would be consistent with a d=1 ARIMA model. Spectral Density - Peak at f=0 - What apepars to be a wave through the rest of the graph- this could be a hidden seasonailty cause another freq peak that is hidden by the pseudo-cyclic behavior mentioned in about the realization above.

plotts.sample.wge(us$hospitalizedCurrently)

## $autplt
##  [1]  1.00000000  0.96469043  0.92302755  0.87525870  0.82267467
##  [6]  0.76543844  0.70485512  0.64064756  0.57236121  0.50115588
## [11]  0.43487093  0.36990327  0.30454204  0.23997040  0.17553357
## [16]  0.11101329  0.04809253 -0.01338519 -0.07128970 -0.12337015
## [21] -0.17223727 -0.21557163 -0.25020503 -0.28191209 -0.30582707
## [26] -0.32569569
## 
## $freq
##  [1] 0.008064516 0.016129032 0.024193548 0.032258065 0.040322581
##  [6] 0.048387097 0.056451613 0.064516129 0.072580645 0.080645161
## [11] 0.088709677 0.096774194 0.104838710 0.112903226 0.120967742
## [16] 0.129032258 0.137096774 0.145161290 0.153225806 0.161290323
## [21] 0.169354839 0.177419355 0.185483871 0.193548387 0.201612903
## [26] 0.209677419 0.217741935 0.225806452 0.233870968 0.241935484
## [31] 0.250000000 0.258064516 0.266129032 0.274193548 0.282258065
## [36] 0.290322581 0.298387097 0.306451613 0.314516129 0.322580645
## [41] 0.330645161 0.338709677 0.346774194 0.354838710 0.362903226
## [46] 0.370967742 0.379032258 0.387096774 0.395161290 0.403225806
## [51] 0.411290323 0.419354839 0.427419355 0.435483871 0.443548387
## [56] 0.451612903 0.459677419 0.467741935 0.475806452 0.483870968
## [61] 0.491935484 0.500000000
## 
## $db
##  [1]  11.5968519  12.3083066  11.5133997   7.4838113   3.3602139
##  [6]   0.0335519   0.7084332   0.9156140  -0.8436600  -3.1819014
## [11]  -5.4756678  -6.7623087  -6.8158311  -8.0631517  -7.3612462
## [16]  -6.6859328  -6.5334837  -9.2703624  -6.9861347  -7.7480548
## [21]  -9.2215880  -9.7427900  -9.8554763 -10.3609260 -12.4875682
## [26] -12.3111041 -12.5834700 -13.5552916 -13.3151569 -12.1559256
## [31] -13.3408790 -11.5752029 -11.5102517 -11.0062561 -13.6956455
## [36] -13.3799405 -12.8275350 -13.5948157 -13.7881199 -16.3540755
## [41] -16.1420426 -16.4026230 -16.3405545 -15.3322041 -13.6672886
## [46] -13.4609040 -13.7211937 -14.9264666 -15.4980009 -14.6885900
## [51] -14.1315883 -14.5816335 -17.2784109 -19.1817384 -15.4061574
## [56] -15.5625062 -15.6189618 -16.0617864 -14.7026778 -16.0503809
## [61] -14.3978563 -13.5639246
## 
## $dbz
##  [1]  10.712613  10.294626   9.591662   8.595197   7.295893   5.688294
##  [7]   3.781244   1.619531  -0.679155  -2.892367  -4.749697  -6.121638
## [13]  -7.103744  -7.844927  -8.408137  -8.813629  -9.124106  -9.444708
## [19]  -9.862010 -10.401184 -11.025434 -11.666349 -12.267299 -12.809609
## [25] -13.299011 -13.732191 -14.084633 -14.333134 -14.485102 -14.579070
## [31] -14.658515 -14.750375 -14.865221 -15.010053 -15.196621 -15.437186
## [37] -15.732991 -16.066124 -16.401571 -16.698827 -16.925920 -17.067717
## [43] -17.126873 -17.121767 -17.083330 -17.048284 -17.048564 -17.101597
## [49] -17.206612 -17.348459 -17.506148 -17.660495 -17.796193 -17.899104
## [55] -17.954838 -17.953353 -17.896777 -17.802335 -17.696364 -17.604163
## [61] -17.543146 -17.522003

Overfit tables

Since we are seeing heavy wandering behavior we will use overfit tables to see if we can surface any (1-B) factors that have roots very near the unit circle. - Below we are able to clearly see 1: (1-B) factor that has a root nearly on the Unit Circle.

est.ar.wge(us$hospitalizedCurrently,p=6,type='burg')
## 
## Coefficients of Original polynomial:  
## 1.1909 0.0509 -0.0756 -0.0840 0.0023 -0.1042 
## 
## Factor                 Roots                Abs Recip    System Freq 
## 1-1.9296B+0.9375B^2    1.0292+-0.0868i      0.9682       0.0134
## 1+0.9752B+0.3505B^2   -1.3911+-0.9580i      0.5921       0.4040
## 1-0.2365B+0.3172B^2    0.3729+-1.7361i      0.5632       0.2163
##   
## 
## $phi
## [1]  1.190923840  0.050864061 -0.075600901 -0.084022737  0.002285954
## [6] -0.104222855
## 
## $res
##   [1]  -325.264880    50.930580   -96.193198  -125.387346  -374.281156
##   [6]  -194.078000  -456.418062   -92.886262  -133.725814  1281.535010
##  [11]  1371.801436  -893.713641  -705.104613  -423.101902   189.943073
##  [16]   490.314897  -112.058738   506.500493  2265.993568  -855.382812
##  [21]  1291.660117  4913.615274 -1950.654296  2101.167402 -1561.969001
##  [26]  -236.630649 -2857.037527  -805.804218  2327.656472  -623.151634
##  [31] -1344.365664  -880.889785  -966.611290  -767.681119  1256.494251
##  [36]  3947.870486  -470.254103  -221.269559 -1555.374553   723.483060
##  [41]  -647.293020   934.135533   804.751750   742.703690  -592.440957
##  [46]  -808.895314   200.464655  -362.780298   849.901242  1924.841589
##  [51]    12.152178  -638.879456  -941.614458  -249.751141  -544.259430
##  [56]   613.095112  2144.982967    56.492234  -673.605034  -714.929799
##  [61]   734.409142 -1017.947881   709.169097   926.134623   314.213722
##  [66]  -301.442700  -902.263971  -757.315173  -218.000102   753.252845
##  [71]   658.741366   979.938784  -116.744733 -1140.500929 -1044.946079
##  [76]  -382.699557   -39.748928   279.519958  -112.654712    39.776547
##  [81]     9.054967  -108.136916  -337.883654   -13.059014   766.977021
##  [86]  -297.850638 -1214.492617  -399.578901  -370.586129  -372.329514
##  [91]   271.647958   775.077981   267.453636  -380.971438   -19.262260
##  [96]  -971.274860    46.638362   504.705617  1190.944510   238.729090
## [101]    -1.571766  -971.795012    87.941385  -616.900429   644.123440
## [106]  1149.837957   387.031717   115.296221  -692.075346  -491.880934
## [111]   -37.679522   541.707264  1448.094968   525.848622  -136.212910
## [116]  6708.217995 -1864.592652 -1484.170274  -236.420281   450.866777
## [121]  -694.855397   692.691074  -206.709326  -556.217313
## 
## $avar
## [1] 1432462
## 
## $aic
## [1] 14.28781
## 
## $aicc
## [1] 15.31404
## 
## $bic
## [1] 14.44702

Difference the data based on surfaced (1-B) Factor

Once the data has been differed we something that looks much closer to a stationary data set. However, we have also surfaced what appears to be a small seasonality component. We see the ACF have higher spikes surface at 7 and 14, which would lead us to believe there is a 7 day seasonal component.

us.diff = artrans.wge(us$hospitalizedCurrently, phi.tr = 1)

Seasonailty Transformation

Above we have surfaced what appears to be a 7 day seasonality trend. We will now transform the data for the s=7.

us.diff.seas = artrans.wge(us.diff,phi.tr = c(0,0,0,0,0,0,1))

Diagnose Model w/ aic.wge

When we diagnose the the best models to use for our stationary data set we see the AIC select a ARMA(5,1) model while the BIC selects a AR(2). The AR(2) model is consistent with our pseudo-cyclic data as well as the dampening cyclical sample autocorrelations that are produced by the transformed data. The ARMA(5,1) could also produce these same traits. We will move forward and compare these two models.

aic5.wge(us.diff.seas)
## ---------WORKING... PLEASE WAIT... 
## 
## 
## Five Smallest Values of  aic
##       p    q        aic
## 17    5    1   14.58983
## 12    3    2   14.61706
## 14    4    1   14.63818
## 10    3    0   14.64214
## 13    4    0   14.64639
aic5.wge(us.diff.seas,type = "bic")
## ---------WORKING... PLEASE WAIT... 
## 
## 
## Five Smallest Values of  bic
##       p    q        bic
## 7     2    0   14.73106
## 10    3    0   14.73709
## 6     1    2   14.74186
## 8     2    1   14.75288
## 17    5    1   14.75600

Diagnose white noise

Both of the Junge Box test show us that we reject the H null with pvalues that are < 0.05 alpha significance level.

ljung.wge(us.diff.seas)$pval
## Obs 0.2551562 0.3832289 0.2777059 0.1275141 0.09296219 0.0898478 -0.2932202 0.0600709 -0.09689984 -0.0006399051 0.01526244 -0.02103579 0.01976312 -0.01353223 -0.05456826 -0.02766127 -0.09564359 -0.1088496 -0.08276253 -0.1151649 -0.1019156 -0.07946092 -0.06270657 -0.08635239
## [1] 3.551215e-05
ljung.wge(us.diff.seas, K=48)$pval
## Obs 0.2551562 0.3832289 0.2777059 0.1275141 0.09296219 0.0898478 -0.2932202 0.0600709 -0.09689984 -0.0006399051 0.01526244 -0.02103579 0.01976312 -0.01353223 -0.05456826 -0.02766127 -0.09564359 -0.1088496 -0.08276253 -0.1151649 -0.1019156 -0.07946092 -0.06270657 -0.08635239 0.007035863 -0.04274568 -0.04721326 -0.0386816 -0.07346947 -0.05386179 0.01834432 -0.0629751 -0.02883663 -0.0004270837 0.00337915 0.01553369 -0.02742407 -0.05095818 -0.01418516 -0.01607667 -0.02314061 -0.01357636 -0.01505951 0.04436695 0.01818611 0.01944229 0.03469226 0.0006925423
## [1] 0.04006747

Estiamte Phis and Thetas

AIC Phi and Theta Estimates

est.us.diff.seasAIC = est.arma.wge(us.diff.seas, p = 5, q=1)
## 
## Coefficients of Original polynomial:  
## -0.6073 0.5495 0.5896 0.0396 -0.3023 
## 
## Factor                 Roots                Abs Recip    System Freq 
## 1+0.9499B             -1.0528               0.9499       0.5000
## 1+1.0086B+0.6463B^2   -0.7802+-0.9687i      0.8039       0.3579
## 1-1.3512B+0.4923B^2    1.3722+-0.3850i      0.7017       0.0435
##   
## 
mean(us$hospitalizedCurrently)
## [1] 37955.28

BIC Phi Estiamtes

est.us.diff.seasBIC = est.arma.wge(us.diff.seas, p = 2)
## 
## Coefficients of Original polynomial:  
## 0.1529 0.4183 
## 
## Factor                 Roots                Abs Recip    System Freq 
## 1-0.7277B              1.3741               0.7277       0.0000
## 1+0.5748B             -1.7396               0.5748       0.5000
##   
## 
mean(us$hospitalizedCurrently)
## [1] 37955.28

Forecasts

ARMA(5,1)

ARMA(5,1) Short Term

shortARMA <- fore.aruma.wge(us$hospitalizedCurrently, phi = est.us.diff.seasAIC$phi, theta = est.us.diff.seasAIC$theta, d= 1, s = 7, n.ahead = 7, lastn = FALSE, limits = FALSE)

  • ASE
ASEshortARMA1 = mean((us$hospitalizedCurrently[(124-7+1):124]-shortARMA$f)^2)
ASEshortARMA1 
## [1] 4680969
ASEshortARMA2 = mean((shortARMA$f-us$hospitalizedCurrently[(length(us$hospitalizedCurrently)-6):length(us$hospitalizedCurrently)])^2)
ASEshortARMA2
## [1] 4680969
  • Windowed ASE

ARMA(5,1) Long Term

longARMA <- fore.aruma.wge(us$hospitalizedCurrently, phi = est.us.diff.seasAIC$phi, theta = est.us.diff.seasAIC$theta, d= 1, s = 7, n.ahead = 90, lastn = FALSE, limits = FALSE)

  • ASE
ASElongARMA1 = mean((us$hospitalizedCurrently[(124-90+1):124]-shortARMA$f)^2)
## Warning in us$hospitalizedCurrently[(124 - 90 + 1):124] - shortARMA$f:
## longer object length is not a multiple of shorter object length
ASElongARMA1 
## [1] 273191644
ASElongARMA2 = mean((shortARMA$f-us$hospitalizedCurrently[(length(us$hospitalizedCurrently)-89):length(us$hospitalizedCurrently)])^2)
## Warning in shortARMA$f -
## us$hospitalizedCurrently[(length(us$hospitalizedCurrently) - : longer
## object length is not a multiple of shorter object length
ASElongARMA2
## [1] 273191644
  • Windowed ASE
phis = est.us.diff.seasAIC$phi
thetas = est.us.diff.seasAIC$theta

trainingSize = 25
horizon = 12
ASEHolder = numeric()

invisible(for( i in 1:(124-(trainingSize + horizon) + 1))
{
  
  forecasts = fore.aruma.wge(us$hospitalizedCurrently[i:(i+(trainingSize-1))],phi = phis, theta = thetas, s = 7, d = 1,n.ahead = horizon)
  
  ASE = mean((us$hospitalizedCurrently[(trainingSize+i):(trainingSize+ i + (horizon) - 1)] - shortARMA$f)^2)
         
  ASEHolder[i] = ASE

})
## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

## Warning in us$hospitalizedCurrently[(trainingSize + i):(trainingSize + i
## + : longer object length is not a multiple of shorter object length

invisible(ASEHolder)
hist(ASEHolder)

WindowedASE = mean(ASEHolder)

summary(ASEHolder)
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
##   4887449  41116322 233726743 277361622 496865940 682241474
WindowedASE
## [1] 277361622
i = 45
fs = fore.aruma.wge(us$hospitalizedCurrently[i:(i+(trainingSize+horizon)-1)],phi = phis, theta = thetas, s = 7, d = 1,n.ahead = 7, lastn = TRUE)

ASE = mean((us$hospitalizedCurrently[(i+trainingSize):(i+(trainingSize+horizon)-1)] - fs$f )^2)
## Warning in us$hospitalizedCurrently[(i + trainingSize):(i + (trainingSize
## + : longer object length is not a multiple of shorter object length
ASE
## [1] 4781164

AR(2)

AR(2) Short Term

shortAR <- fore.aruma.wge(us$hospitalizedCurrently, phi = est.us.diff.seasBIC$phi, d = 1, s = 7, n.ahead = 7, lastn = FALSE, limits = FALSE)

AR(2) Long Term

longAR <- fore.aruma.wge(us$hospitalizedCurrently, phi = est.us.diff.seasBIC$phi, d = 1, s = 7, n.ahead = 90, lastn = FALSE, limits = FALSE)